package android.crosstime.hes;

import java.util.ArrayList;

import android.content.Context;

public class FloatDialogManager {
	
	private ArrayList<FloatDialog> mDialogList = null;

	public FloatDialogManager(){
		mDialogList = new ArrayList<FloatDialog>();
	}
	
	public void add(FloatDialog dialog){
		mDialogList.add(dialog);
	}
	
	public FloatDialog createNewDialog(Context context, String filePath){
		FloatDialog newDlg = new FloatDialog(context, filePath);
		this.add(newDlg);
		return newDlg;
	}
	
	public void remove(FloatDialog dialog){
		if(mDialogList.indexOf(dialog) != -1)
			mDialogList.remove(dialog);
	}
	
	public void clearList(){
		mDialogList.clear();
	}
	
	public FloatDialog getDialogbyIndex(int index){
		if(index < 0 || index >= mDialogList.size())
			return null;
		return mDialogList.get(index);
	}
	
	public int getIndexByDialog(FloatDialog dialog){
		if(dialog == null)
			return -1;
		return mDialogList.indexOf(dialog);
	}
	
	//TODO: extend to provide more func.
	public int getCurrentFocusIndex(){ return -1; }
}
